package com.jackstraw.create.controller;

import com.jackstraw.create.param.RespResult;
import com.jackstraw.create.pojo.CreateInfo;
import com.jackstraw.create.service.ICreateService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * 版权所有： 稻草人
 * 所在包：com.jackstraw.create.controller
 * 文件名：
 * 项目：create
 * 功能描述：
 * 修改时间：2021-04-16 23:31
 *
 * @author jackstraw
 */
@RestController
@RequestMapping(value="/create")
public class CreateController {
    @Resource
    private ICreateService createService;

    /**
     * 生成文件
     * @param createInfo
     * @return
     */
    @PostMapping(value="/create")
    public RespResult create(CreateInfo createInfo) {
        RespResult result = null;
        try {
            createService.createFile(createInfo);
            result = RespResult.success();
        } catch (Exception e) {
            e.printStackTrace();
        }
        return result;
    }
}
